package com.grasscove.namethat;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;

public class Rules extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);		

		setContentView(R.layout.rules);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		menu.add(0, HomeActivity.OPTION_MENU_PLAY, 1, "Play").setIcon(R.drawable.play_menu_icon);
		menu.add(0, HomeActivity.OPTION_MENU_RULES, 2, "Rules").setIcon(R.drawable.rules_menu_icon);
		//menu.add(0, OPTION_MENU_ABOUT, 3, "About").setIcon(R.drawable.play_menu_icon);
		menu.add(0, HomeActivity.OPTION_MENU_SETTINGS, 4, "Settings").setIcon(R.drawable.settings_menu_icon);

		return super.onCreateOptionsMenu(menu);
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		Intent mIntent;

		switch (item.getItemId()) {
			case HomeActivity.OPTION_MENU_PLAY:
				mIntent = new Intent(this, CategoriesList.class);
				mIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
				startActivity(mIntent);
				break;
			case HomeActivity.OPTION_MENU_RULES:
				mIntent = new Intent(this, Rules.class);
				mIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
				startActivity(mIntent);
				break;
			case HomeActivity.OPTION_MENU_ABOUT:
				break;
			case HomeActivity.OPTION_MENU_SETTINGS:
				mIntent = new Intent(this, SettingsList.class);
				mIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
				startActivity(mIntent);
				break;
			default:
				break;
		}

		return super.onOptionsItemSelected(item);
	}
}
